<?php

/**
 * 订单商品售后定时统计脚本
 *
 * @author jc
 * @data 19/9/10
 *
 */
namespace app\statis\command;

use app\common\helper\Time;
use app\statis\lib\TimeStatistic;
use app\statis\model\StatOrderModel;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\App;
use think\facade\Log;

class ProductService extends Command
{

    protected function configure()
    {
        $this->setName('product_service')
            ->setDescription('订单商品售后统计');
    }

    protected function execute(Input $input, Output $output)
    {
        Log::init([
            'path' => App::getRuntimePath() . 'log/stat/product_service/',
        ]);

        $output->info('----service_stat start_time ----' . date('Y-m-d H:i:s', time()));
        $output->info('----service_stat task start----');

        /*业务处理*/
        $stat_time  = '2019-09-10';
        $start_time = TimeStatistic::getStartTime($stat_time);
        $end_time   = TimeStatistic::getEndTime($stat_time);
        $statOrderM = new StatOrderModel();
        $statOrderM->summary($start_time, $end_time);

        $output->info('----order_stat task end----');
    }

}